package cn.laixueit.Log;

import cn.laixueit.mapper.UserMapper;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class Log {

    @Autowired
    private UserMapper userMapper;


    @Before("execution(* cn.laixueit.service.UserService.add(..))")
    public void before_log(){
        System.out.println("开始记录");
    }


    @Before("execution(* cn.laixueit.service.UserService.add(..))")
    public void before_log2(){
        System.out.println("开始记录2");
    }

    @After("execution(* cn.laixueit.service.UserService.*(..))")
    public void after_log(){
        System.out.println("记录完毕");
        userMapper.add();
    }

    @Before("execution(* cn.laixueit.service.UserService.delete(..))")
    public void before_del(){
        System.out.println("删除开始之前的数据验证");
    }


}
